home *** CD-ROM | disk | FTP | other *** search
/ SGI Desktop Special Edition 1.1 / SGI Desktop Special Edition 1.1.iso / dist / SoftWindows2.idb / usr / lib / SoftWindows2 / chkold.pl.z / chkold.pl
Encoding:
Perl Script  |  1995-11-13  |  971 b   |  48 lines

  1. #!/usr/sbin/perl
  2.  
  3. $K=1024;        #1-K
  4. $Meg=$K*$K;        #1-Meg
  5. $XCONFIRM='/usr/bin/X11/xconfirm';
  6.  
  7. $name=$ENV{"USER"};
  8. $home=$ENV{"HOME"};
  9.  
  10. $OLD_DISK="$home/WIN31-$name.hdf";
  11. $NEW_DISK="$home/WIN311-$name.hdf";
  12.  
  13.  
  14. #get free disk space on home device
  15. $_=`/usr/sbin/df -k $home|/bin/tail -1`;
  16. ($free_space)=/.{27}\s*\S+\s+\d+\s+\d+\s+(\d+).*/;
  17.  
  18.  
  19. #find size of old hard disk in K
  20.  
  21. $old_size=((($old_exists=-R $OLD_DISK)?-s $OLD_DISK:0)+$K-1)/$K;
  22. $old_MB=int(($old_size+$K-1)/$K);
  23.  
  24. if (!$old_exists) {
  25.     #nothing to complain about
  26.     exit 0;
  27. }
  28.  
  29. #put up warning
  30.  
  31.     $prog="$XCONFIRM".' -c -B "Yes" -b "No" '.
  32.         '-header "Delete old hard disk" '.
  33.         "-t $OLD_DISK ".
  34.         '-t "You still have an old hard disk that is" '.
  35.         '-t "taking up millions and millions of" '.
  36.         '-t "bytes ('."$old_MB".' Meg).  This file is needed " '.
  37.         '-t "if you still wish to run SoftWindows 1.X." '.
  38.         '-t "Delete?" '.
  39.         '-icon question -geometry "360x190"';
  40.  
  41. $_=`$prog`;
  42.  
  43. if (/Yes/) {
  44.     unlink($OLD_DISK);
  45. }
  46. exit 0;
  47.  
  48.